package com.eos.control.action.customer;

import com.eos.business.service.SysCustomerBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysCustomerLink;

public class SaveCustomerLinkAction extends AbstractBaseAction {
	private static final long serialVersionUID = 7799722865662335657L;
	private Integer customerId;
	private String linkName;
	private String linkJob;
	private String linkTelephone;
	private String linkMobile;
	private String linkFax;
	private String linkQq;
	private String linkWx;
	private String jobDuty;

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public void setLinkName(String linkName) {
		this.linkName = linkName;
	}

	public void setLinkJob(String linkJob) {
		this.linkJob = linkJob;
	}

	public void setLinkTelephone(String linkTelephone) {
		this.linkTelephone = linkTelephone;
	}

	public void setLinkMobile(String linkMobile) {
		this.linkMobile = linkMobile;
	}

	public void setLinkFax(String linkFax) {
		this.linkFax = linkFax;
	}

	public void setLinkQq(String linkQq) {
		this.linkQq = linkQq;
	}

	public void setLinkWx(String linkWx) {
		this.linkWx = linkWx;
	}

	public void setJobDuty(String jobDuty) {
		this.jobDuty = jobDuty;
	}

	@Override
	public String execute() {
		try {
			if(customerId == null || customerId.intValue() <=0){
				statusCode = "300";
				message = "参数错误, 新增客户联系信息失败!";
			} else{
				SysCustomerLink scl = new SysCustomerLink();
				scl.setDealFlag(ConstantTool.DEAL_FALG_OK);
				scl.setCustomerId(customerId);
				scl.setJobDuty(jobDuty);
				scl.setLinkFax(linkFax);
				scl.setLinkJob(linkJob);
				scl.setLinkMobile(linkMobile);
				scl.setLinkName(linkName);
				scl.setLinkQq(linkQq);
				scl.setLinkTelephone(linkTelephone);
				scl.setLinkWx(linkWx);
				scl.setStatus(ConstantTool.STATUS_OK);
				SysCustomerBusinessService scs = new SysCustomerBusinessService();
				String exeStatus = scs.saveCustomerLink(scl);
				if("SUCCESS".equals(exeStatus)){
					statusCode = "200";
					message = "新增客户联系信息成功!";
				}else{
					 statusCode = "300";
					 message = "系统繁忙, 新增客户联系信息失败!";
				}
			}
		} catch (Exception e) {
			 e.printStackTrace();
			 statusCode = "300";
			 message = "系统异常, 新增客户联系信息失败!";
		}
		return SUCCESS;
	}
}
